﻿using System;
using System.Xml.Serialization;

namespace Scrabble.Model
{
    [Serializable]
    public class RecordOfPlay
    {
        [XmlIgnore]
        public TimeSpan DurationOfPlay { get; set; }

        [XmlAttribute]
        public string Type;

        [XmlElement]
        public string Notation;

        [XmlAttribute("DurationOfPlay")]
        public int TotalSecondsInPlay
        {
            get { return (int) DurationOfPlay.TotalSeconds; }
            set { DurationOfPlay = TimeSpan.FromSeconds(value); }
        }

    }

    [Serializable]
    [XmlRoot("ScrabbleGame")]
    public class StateOfPlay
    {
        [XmlAttribute] 
        public int Seed;

        [XmlArray] 
        public string[] NamesOfPlayers;

        //[XmlArray] 
        //[XmlArrayItem("Play")]
        //public string[] SetOfPlays;

        [XmlArray]
        public RecordOfPlay[] EventLog;
    }
}